import { MyGameObject } from "./MyGameObject";

export class BOMB extends MyGameObject{
    constructor(r,c,gamemap)
    {
        super();
        this.gamemap = gamemap;
        this.ctx = gamemap.ctx;

        this.r = r;
        this.c = c;

        this.frame_current_cnt = 0;

        this.animations = this.gamemap.gif.animations.get(1);

    }

    start(){

    }


    update(){
        this.render();
    }

    render(){
        const L = this.gamemap.L;
        this.frame_current_cnt++;
        let k = parseInt(this.frame_current_cnt / this.animations.frame_rate)
        if(k >= this.animations.frame_cnt)
        {
            this.destroy();
            return;
        }
        let img = this.animations.gif.frames[k].image;
        this.ctx.drawImage(img, (this.c-2.5) * L, (this.r-2.5) * L,L*6,L*6);
    }



}

